home *** CD-ROM | disk | FTP | other *** search
/ Aminet 23 / Aminet 23 (1998)(GTI - Schatztruhe)[!][Feb 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / Asm / Screens / DoubleBuffer.s < prev    next >
Text File  |  1997-12-10  |  3KB  |  122 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;This just shows how to double buffer the screen.  You can also try out
  3. ;triple buffering just by changing the DBLBUFFER flag to TPLBUFFER in the
  4. ;GameScreen.
  5.  
  6.     INCDIR    "GMSDev:Includes/"
  7.     INCLUDE    "dpkernel/dpkernel.i"
  8.  
  9.     SECTION    "Start",CODE
  10.  
  11. ;===========================================================================;
  12. ;                             INITIALISE DEMO
  13. ;===========================================================================;
  14.  
  15.     STARTDPK
  16.  
  17. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  18.     move.l    DPKBase(pc),a6
  19.     lea    ScreenTags(pc),a0    ;Init screen.
  20.     sub.l    a1,a1
  21.     CALL    Init
  22.     tst.l    d0
  23.     beq.s    .Exit
  24.  
  25.     move.l    Screen(pc),a1
  26.     lea    PictureTags(pc),a0    ;Load background picture.
  27.     move.l    GS_MemPtr1(a1),PicData
  28.     sub.l    a1,a1
  29.     CALL    Init
  30.     tst.l    d0
  31.     beq.s    .Exit
  32.  
  33.     move.l    SCRBase(pc),a6
  34.     move.l    Screen(pc),a0
  35.     move.l    Picture(pc),a1
  36.     move.l    PIC_Palette(a1),GS_Palette(a0)
  37.     CALL    scrUpdatePalette
  38.  
  39.     move.l    DPKBase(pc),a6
  40.     moveq    #ID_JOYDATA,d0    ;Get joydata structure.
  41.     CALL    Get
  42.     move.l    d0,JoyData
  43.     beq.s    .Exit
  44.     move.l    d0,a0    ;Initialise the joydata structure.
  45.     sub.l    a1,a1
  46.     CALL    Init
  47.     tst.l    .Exit
  48.  
  49.     move.l    Screen(pc),a0
  50.     CALL    Display
  51.  
  52.     bsr.s    Main
  53.  
  54. .Exit    move.l    DPKBase(pc),a6
  55.     move.l    JoyData(pc),a0
  56.     CALL    Free
  57.     move.l    Picture(pc),a0
  58.     CALL    Free
  59.     move.l    Screen(pc),a0
  60.     CALL    Free
  61.     MOVEM.L    (SP)+,A0-A6/D1-D7
  62.     moveq    #ERR_OK,d0
  63.     rts
  64.  
  65. ;===========================================================================;
  66. ;                                MAIN LOOP
  67. ;===========================================================================;
  68.  
  69. Main:    move.l    SCRBase(pc),a6
  70.     CALL    scrWaitAVBL
  71.  
  72.     move.l    Screen(pc),a0
  73.     CALL    scrSwapBuffers
  74.  
  75.     move.l    DPKBase(pc),a6
  76.     move.l    JoyData(pc),a0
  77.     CALL    Query
  78.     move.l    JoyData(pc),a0
  79.     move.l    JD_Buttons(a0),d0
  80.     btst    #JB_LMB,d0
  81.     beq.s    Main
  82.     rts
  83.  
  84. ;===========================================================================;
  85. ;                                  DATA
  86. ;===========================================================================;
  87.  
  88. JoyData:    dc.l  0
  89. ScreenTags:    dc.l  TAGS_SCREEN
  90. Screen:        dc.l  0
  91.         dc.l  GSA_Width,320
  92.         dc.l  GSA_Height,256
  93.         dc.l  GSA_Attrib,DBLBUFFER
  94.         dc.l    GSA_BitmapTags,0
  95.         dc.l    BMA_AmtColours,32
  96.         dc.l    TAGEND,0
  97.         dc.l  TAGEND
  98.  
  99. PictureTags:    dc.l  TAGS_PICTURE
  100. Picture:    dc.l  0
  101.         dc.l    PCA_BitmapTags,0
  102.         dc.l    BMA_Data
  103. PicData:    dc.l    0
  104.         dc.l    BMA_Width,320
  105.         dc.l    BMA_Height,256
  106.         dc.l    BMA_AmtColours,32
  107.         dc.l    TAGEND,0
  108.         dc.l  PCA_Source,.file
  109.         dc.l  TAGEND
  110.  
  111. .file        FILENAME "GMS:demos/data/PIC.Green"
  112.  
  113. ;===========================================================================;
  114.  
  115. ProgName:    dc.b  "Double Buffer",0
  116. ProgAuthor:    dc.b  "Paul Manias",0
  117. ProgDate:    dc.b  "10 December 1997",0
  118. ProgCopyright:    dc.b  "DreamWorld Productions (c) 1996-1997.  Freely distributable.",0
  119. ProgShort:    dc.b  "Double buffer demonstration.",0
  120.         even
  121.  
  122.